<script language="JavaScript">
	function onEnter(event, form)
	{
		var keyCode = null;
		if( event.which ) 
		{
			keyCode = event.which;
		} 
		else if( event.keyCode ) 
		{
			keyCode = event.keyCode;
		}
		if( 13 == keyCode ) 
		{
			new Ajax.Updater('messages', '/chatroom/send_message', {asynchronous:true, evalScripts:true, parameters:Form.serialize(form)});
			form.message_message.value = '';
			return false;
		}
		
	}
</script>

<div id="main">
	
	<%= periodically_call_remote :url => {:action => 'update_messages'}, :update => 'messages', :frequency => 2 %>
	
	
	<h4>Chatroom:</h4><h3><%= @current_chatroom.name %></h3>
	<br/>

	<h4>Messages:</h4>	
	<div id="messages">
		<%= render :partial => "messages" %>
	</div>
	
	<div id="send_message">
		<%= render :partial => "send_message" %>
	</div>

</div>
<div id="sidebar">
	<h4>Users</h4>
	<%= render :partial => "users" %>	
</div>
